package com.sunjq.callback;

public class Caller {

//	public Callee callee = new Callee();
	private CallBackInterface callbackInterface = new CallBackInterface() {
		
		public void callbackInterfaceMethod() {
			System.out.print("INnerclass");
		}
	};
	
	private CalleeError callee = new CalleeError();
	
	public CalleeError getCallee() {
		return callee;
	}

	public void setCallee(CalleeError callee) {
		this.callee = callee;
	}

	public CallBackInterface getCallbackInterface() {
		return callbackInterface;
	}

	public void setCallbackInterface(CallBackInterface callbackInterface) {
		this.callbackInterface = callbackInterface;
	}

	public void doSomething() {
//		callee.methodCall();
		System.out.println("do my something....");
		callbackInterface.callbackInterfaceMethod();
		System.out.println("continue doing my things..");
	}
	
	public void doErrorSomething() {
//		callee.methodCall();
		System.out.println("do my something....");
		callee.callbackInterfaceMethodError();
		System.out.println("continue doing my things..");
	}
	
//	 public static void main(String args[])  
//	    {  
//	       Caller call = new Caller();  
//	       call.methodTobeCallBack();
//	       
//	    }  
	
	public static void main(String args[])  
    {  
       Caller call = new Caller();  
//       call.callbackInterface = new Callee();
       call.setCallbackInterface(new Callee());
       call.setCallee(new CalleeError());
//       call.doSomething();
       call.doErrorSomething();
       
    }


}
